home *** CD-ROM | disk | FTP | other *** search
- property spriteNum, piece, action, myOgLoc, myLoc, myOgRot, oj
- global randomPieceLocation, rotationList, equal, completePuzzle, pootimer, points, win
-
- on beginSprite me
- piece = sprite(spriteNum)
- myOgLoc = piece.loc
- piece.loc = randomPieceLocation[random(randomPieceLocation.count)]
- myLoc = piece.loc
- randomPieceLocation.deleteOne(piece.loc)
- rotlist = [90, 180, 270]
- piece.rotation = piece.rotation - rotlist[random(rotlist.count)]
- end
-
- on mouseEnter me
- piece.locZ = spriteNum + 1000
- end
-
- on mouseLeave me
- piece.locZ = spriteNum
- end
-
- on mouseDown me
- action = timeout("LLK").new(200, #dowhat, me)
- end
-
- on dowhat me
- action.forget()
- if the mouseDown then
- puppetSound(4, member("pick up piece"))
- action = timeout("LLK").new(5, #moveme, me)
- oj = timeout("hffgh").new(1, #checkthis, me)
- else
- puppetSound(4, member("rotate"))
- piece.rotation = piece.rotation + 90
- if (piece.rotation = 360) or (piece.rotation = -360) then
- piece.rotation = 0
- end if
- end if
- end
-
- on moveme me
- if the mouseDown then
- piece.locZ = spriteNum + 1000
- piece.loc = the mouseLoc
- else
- if the mouseUp then
- action.forget()
- if (the mouseH < 115) or (the mouseH > 462) or ((the mouseV < 89) or (the mouseV > 353)) then
- newELoc = point(the mouseH, the mouseV)
- if (newELoc[1] > 0) and (newELoc[1] < 580) and (newELoc[2] > 0) and (newELoc[2] < 440) then
- piece.loc = newELoc
- myLoc = piece.loc
- else
- piece.loc = myLoc
- piece.locZ = spriteNum
- end if
- else
- piece.loc = myLoc
- piece.locZ = spriteNum
- end if
- end if
- end if
- end
-
- on checkthis me
- if the mouseDown then
- if (the mouseLoc > (myOgLoc - point(10, 10))) and (the mouseLoc < (myOgLoc + point(10, 10))) then
- if piece.rotation = 360 then
- piece.rotation = myOgRot
- end if
- if piece.rotation = myOgRot then
- equal = 1
- else
- equal = 0
- end if
- else
- equal = 0
- end if
- else
- if the mouseUp then
- oj.forget()
- end if
- end if
- end
-
- on mouseUp me
- puppetSound(4, member("drop piece"))
- if equal then
- action.forget()
- piece.locZ = spriteNum
- piece.loc = myOgLoc
- piece.scriptInstanceList.deleteAll()
- equal = 0
- points = points + 25
- do("completePuzzle" & chars(piece.member.name, 1, 3) & ".add(piece.member.name)")
- if (completePuzzle[1].count + completePuzzle[2].count + completePuzzle[3].count + completePuzzle[4].count + completePuzzle[5].count + completePuzzle[6].count) = (6 * 8) then
- win = "yes"
- pootimer = timeout("rwer").new(150, #gotoit, me)
- end if
- else
- end if
- end
-
- on gotoit me
- pootimer.forget()
- go("gameover")
- end
-